<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../css/element.css" rel="stylesheet"/>
    <link href="../css/styleindex.css" rel="stylesheet"/>
    <style>
    .el-input__inner{
      border: 0;
      font-size: 1rem;
      text-align: center;
    }.el-input__prefix{
      display: none;
    }
    </style>
</head>
<body style="background:#EFF0F4;">

  <div class="mui-content">
    <div id="vm" class="x-examok" v-cloak>
      <div class="x-header-g" id="header">
        <a class="x-header-arrow" @click="api.closeWin()"></a>
        <div class="x-header-t">案例萃取</div>
      </div>
      <!--  -->
      <div class="x-ico-month x-ico-month2">
        <el-date-picker v-model="cardsmonth" type="month" placeholder="选择月" @change="getmonthdata" format="yyyy 年 MM 月" value-format="yyyyMM" :editable="notkey"></el-date-picker>
      </div>
      <!--  -->
      <el-table :data="tabledata" @cell-click="">
        <el-table-column label="萃取时间" width="" fixed>
          <template slot-scope="scope">
            {{scope.row.in_time}}
          </template>
        </el-table-column>
        <el-table-column label="案例主题" width="">
          <template slot-scope="scope">
            {{scope.row.title}}
          </template>
        </el-table-column>
        <el-table-column label="案例类型" width="">
          <template slot-scope="scope">
            <div v-if="scope.row.cate_title!=''">{{scope.row.cate_title}}</div>
            <div v-else>无</div>
          </template>
        </el-table-column>
        <el-table-column label="萃取人" width="">
          <template slot-scope="scope">
            <div v-if="scope.row.username!=''">{{scope.row.username}}</div>
            <div v-else>无</div>
          </template>
        </el-table-column>
        <el-table-column label="完善内容">
          <template slot-scope="scope">
            <el-button type="text" size="mini" @click="addfeed('3',scope.row)">编辑</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!--  -->
      <div class="x-pro-gobtn" @click="addfeed('1')" v-show="!isfromindex">添加新萃取</div>
     
    </div>
  </div>

  <script type="text/javascript" src="../script/vue.js"></script>
  <script type="text/javascript" src="../script/element.js"></script>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript" src="../script/base.js"></script>
	<script>
apiready = function () {
    $api.fixStatusBar($api.byId('header'));
    api.addEventListener({
        name: 'addcaseback'
    }, function(ret, err) {
        vm.getdata()
    });

    //
    var vm = new Vue({
      el:'#vm',
      data(){
        return{
            cardsmonth:'',
            notkey:false,
            tabledata:[],
            isfromindex:false,
            edittoast:false,
            textvalue:'',
            input4:'',
            listid:'',

        }
      },
      created:function() {
        var that=this;


      },
      mounted:function(){
        var that=this;
        //当前月份
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth()+1;
        if(month<10){
          month = '' + 0 + month;
        }
        var toMonth = '' + year + month ;
        that.cardsmonth = toMonth;
        that.getdata()

      },
      methods: {
        //
        getdata:function(){
            let that=this;
            api.ajax({
                url:baseurl+'api/guide/caseList',
                methods:'get',
                data:{
                values:{
                        sec: $api.getStorage('apptoken'),
                        date:that.cardsmonth
                    }
                }
            },function(ret,err){
                if(ret){
                api.hideProgress();
                console.log(JSON.stringify(ret));
                if(ret.status == 1){
                    that.tabledata = ret.data.list;
                    
                    
                }else{
                    api.toast({
                        msg: ret.msg,
                        duration: 3000,
                        location: 'bottom'
                    });
                }
                }else{
                api.hideProgress();
                console.log(JSON.stringify(err));
                api.toast({
                    msg: err.msg,
                    duration: 3000,
                    location: 'bottom'
                });
                }
            })
        },
        //
        getmonthdata:function(val){
            var that = this;
            that.cardsmonth = val;
            that.getdata()
        },
        //
        addfeed:function(type,desc){
            var that = this;
            api.openWin({
                name: 'addcase',
                url: './addcase.html',
                pageParam: {
                    date: that.cardsmonth,
                    type:type,//1新增 2查看 3编辑
                    listdesc:desc,//编辑页desc
                }
            });
        },
    
      }
    })
	}


	</script>
</body>
</html>
